package cn.dmp.utils

object RptUItils {
  // 是不是 原始请求，有效请求，广告请求。List[Double](原始请求，有效请求，广告请求)
  def caculateReq(reqMode: Int, proNode: Int): List[Double] ={
    //这里我用List[Double]放了三个数据，分别代表：(原始请求，有效请求，广告请求)
    if(reqMode == 1 && proNode == 1) {
      List[Double](1,0,0)
    } else if (reqMode == 1 && proNode == 2){
      List[Double](1,1,0)
    } else if (reqMode == 1 && proNode >= 3){
      List[Double](1,1,1)
    } else {
      List[Double](0,0,0)
    }
  }

  // 参与竞价,竞价成功,消费,成本。List[Double](参与竞价,竞价成功, 消费, 成本)
  def caculateRtb(effective: Int,billing: Int, bid: Int, adorderid: Int, win: Int, winPrice: Double, adPayment:Double): List[Double] ={
    if (effective == 1 && billing == 1 && bid == 1 && adorderid != 0) {
      List[Double](1,0,0,0)//代表(原始请求，参与竞价,竞价成功,消费,成本)
    }
    else if (effective == 1 && billing == 1 && win == 1) {
      List[Double](0, 1, winPrice/1000.0, adPayment/1000.0)
    }
    else List[Double](0, 0, 0, 0)
  }

  // 广告展示，点击
  def caculateShowClick(reqMode: Int, effective: Int): List[Double] ={
    if (reqMode == 2 && effective == 1) {
      List[Double](1,0)
    } else if (reqMode == 3 && effective == 1) {
      List[Double](0,1)
    } else {
      List[Double](0,0)
    }
  }
}
